import 'package:taonile/generated/json/base/json_field.dart';
import 'package:taonile/generated/json/refund_order_detail_entity.g.dart';
import 'dart:convert';

@JsonSerializable()
class RefundOrderDetailEntity {
  late int code = 0;
  late String msg;
  late RefundOrderDetailData data = RefundOrderDetailData();

  RefundOrderDetailEntity();

  factory RefundOrderDetailEntity.fromJson(Map<String, dynamic> json) =>
      $RefundOrderDetailEntityFromJson(json);

  Map<String, dynamic> toJson() => $RefundOrderDetailEntityToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class RefundOrderDetailData {
  late int id;
  late int type;
  late int status;
  @JSONField(name: "order_no")
  late String orderNo;
  @JSONField(name: "order_goods_id")
  late int orderGoodsId;
  @JSONField(name: "refund_reason")
  late String refundReason;
  late int num;
  @JSONField(name: "total_price")
  late String totalPrice;
  @JSONField(name: "created_at")
  late String createdAt;
  late String describe;
  late String image = '';
  @JSONField(name: "sku_data")
  late List<RefundOrderDetailDataSkuData> skuData = [];
  late String title;

  @JSONField(name: "goods_name")
  late String goodsName;
  @JSONField(name: "goods_image")
  late String goodsImage;

  late String name = '';
  late String phone = '';
  late String address = '';

  late int detial;
  @JSONField(name: "order_drawback_plan")
  late List<RefundOrderDetailDataOrderDrawbackPlan> orderDrawbackPlan = [];

  RefundOrderDetailData();

  factory RefundOrderDetailData.fromJson(Map<String, dynamic> json) =>
      $RefundOrderDetailDataFromJson(json);

  Map<String, dynamic> toJson() => $RefundOrderDetailDataToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class RefundOrderDetailDataSkuData {
  @JSONField(name: "sku_key")
  late String skuKey;
  @JSONField(name: "sku_val")
  late String skuVal;

  RefundOrderDetailDataSkuData();

  factory RefundOrderDetailDataSkuData.fromJson(Map<String, dynamic> json) =>
      $RefundOrderDetailDataSkuDataFromJson(json);

  Map<String, dynamic> toJson() => $RefundOrderDetailDataSkuDataToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class RefundOrderDetailDataOrderDrawbackPlan {
  late int id;
  @JSONField(name: "shop_order_drawback_id")
  late int shopOrderDrawbackId;
  late String title;
  late String detail = '';
  @JSONField(name: "created_at")
  late String createdAt;
  @JSONField(name: "updated_at")
  dynamic updatedAt;

  RefundOrderDetailDataOrderDrawbackPlan();

  factory RefundOrderDetailDataOrderDrawbackPlan.fromJson(Map<String, dynamic> json) =>
      $RefundOrderDetailDataOrderDrawbackPlanFromJson(json);

  Map<String, dynamic> toJson() => $RefundOrderDetailDataOrderDrawbackPlanToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}
